import { Entity, Column, PrimaryGeneratedColumn, ManyToOne, CreateDateColumn, OneToMany } from 'typeorm';
import { Comment } from 'src/modules/comment/entities/comment.entity';
import { User } from "src/modules/user/entities/user.entity";
@Entity()
export class Article {
  @PrimaryGeneratedColumn("uuid")
  articleid: string;

  @ManyToOne(() => User, (user) => user.articles)
  user: User;

  @Column()
  title: string;

  @Column({ type: 'longtext', charset: 'utf8mb4' })
  content: string;

  @OneToMany(() => Comment, (comment) => comment.article)
  comments: Comment[];

  @Column({
    default: 0
  })
  like: number;
  @Column({
    default: 0
  })
  read: number;
  @Column({
    default: 0
  })
  unlike: number;
  @CreateDateColumn({
    type: 'timestamp'
  })
  create_time: Date

  collects:number;

}

